package IC.AST.nodes;

import IC.AST.*;

/**
 * a while statement
 */
public class WhileStmt extends Statement {
	private Expression condition;	// the while condition
	private Statement body;	// the loop statement

	/**
	 * @param condition the while condition
	 * @param body the loop statement
	 * @param line the node line number
	 * @param column the node column number
	 */
	public WhileStmt(Expression condition, Statement body, int line, int column) {
		super(line,column);
		this.condition = condition;
		this.body = body;
	}

	/**
	 * @return the while condition
	 */
	public Expression getCondition() {
		return this.condition;
	}

	/**
	 * @return the loop statement
	 */
	public Statement getBody() {
		return this.body;
	}

	public Object accept(Visitor v) {
		return v.visit(this);
	}
}
